import numpy as np

class Sigmoid():
    @staticmethod
    def fn(z):
        return 1 / (1 + np.exp(-z))
    
    @staticmethod
    def grad(x):
        fn_x = Sigmoid.fn(x)
        return fn_x * (1 - fn_x)

    @staticmethod
    def grad2(x):
        fn_x = Sigmoid.fn(x)
        return fn_x * (1 - fn_x) * (1 - 2 * fn_x)

class ReLu():
    @staticmethod
    def fn(z):
        a = np.zeros_like(z)
        return np.max(z, a)

    @staticmethod
    def grad(x):
        return 1 if x > 0 else 0

    @staticmethod
    def grad2(x):
        return np.zeros_like(x)